package com.augurit.gzcgwsp.lhsp.convert;

import java.util.ArrayList;
import java.util.List;

import org.dozer.DozerBeanMapper;

import com.augurit.gzcgwsp.lhsp.entity.LhspUpdateFlowResult;
import com.augurit.gzcgwsp.lhsp.web.form.LhspUpdateFlowResultForm;

public class LhspUpdateFlowResultConvert {
	public static LhspUpdateFlowResultForm convertVoToForm(LhspUpdateFlowResult entity) {
		if(entity != null) {
			LhspUpdateFlowResultForm form = new DozerBeanMapper().map(entity, LhspUpdateFlowResultForm.class);
			return form;
		}else
			return null;
	}
	
	public static List<LhspUpdateFlowResultForm> convertVoListToFormList(List<LhspUpdateFlowResult> lhspUpdateFlowResultList) {
		if(lhspUpdateFlowResultList != null && lhspUpdateFlowResultList.size() > 0) {
			List<LhspUpdateFlowResultForm> lhspUpdateFlowResultFormList = new ArrayList();
			for(int i=0; i<lhspUpdateFlowResultList.size(); i++) {
				lhspUpdateFlowResultFormList.add(convertVoToForm(lhspUpdateFlowResultList.get(i)));
			}
			return lhspUpdateFlowResultFormList;
		}
		return null;
	}
	
	
	public static void convertFormToVo(LhspUpdateFlowResultForm form, LhspUpdateFlowResult entity) {
        if (form == null) return;
        if (entity == null) entity = new LhspUpdateFlowResult();        
        new DozerBeanMapper().map(form, entity);
    }
	
	public static List<LhspUpdateFlowResult> convertFormListToVoList(List<LhspUpdateFlowResultForm> LhspUpdateFlowResultFormList) {
		if(LhspUpdateFlowResultFormList != null && LhspUpdateFlowResultFormList.size() > 0) {
			List<LhspUpdateFlowResult> lhspUpdateFlowResultList = new ArrayList();
			for(int i=0; i<LhspUpdateFlowResultFormList.size(); i++) {
				LhspUpdateFlowResult LhspUpdateFlowResult = new LhspUpdateFlowResult();
				convertFormToVo(LhspUpdateFlowResultFormList.get(i), LhspUpdateFlowResult);
				lhspUpdateFlowResultList.add(LhspUpdateFlowResult);
			}
			return lhspUpdateFlowResultList;
		}
		return null;
	}
	
}
